#include<stdio.h>
#include<string.h>
#include<assert.h>
#include<math.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"


int testAdventurer(int player, struct gameState*state);

int main() 
{
        int player;
	struct gameState state;
        //struct gameState state = malloc(sizeof(gameState));

        SelectStream(2);
        PutSeed(3);

        for (int i = 0; i < 100; i++) 
	{
		for(int j = 0;j < sizeof(struct gameState);j++)
		{
			((char*)&state)[j] = floor(Random() * 256);
		}
				
                player = floor((Random() * 3));

		state.numPlayers = 3;		
                state.deckCount[player] = floor(Random() * MAX_DECK);
                state.discardCount[player] = floor(Random() * (MAX_DECK - state.deckCount[player]));
                state.handCount[player] = floor(Random() * MAX_HAND);
		state.whoseTurn = player;		
                testAdventurer(player, &state);
        }
}

int testAdventurer(int player, struct gameState*state) 
{
        int discard = state->discardCount[player];
        int deck = state->deckCount[player];
        int hand = state->handCount[player];
	int temphand[MAX_HAND];

	adventurerEffect(0, player, state, 0, temphand);

        int deck2 = state->deckCount[player];
        int discard2 = state->discardCount[player];
        int hand2 = state->handCount[player];
printf("%d : %d\n", hand, hand2);
        assert(deck2 + discard2 != deck + discard);
        assert(hand2 == hand + 1);

        return 0;
}


